<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: yahoo   YAHOO.js  (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/api.css">
</head>

<body id="yahoo-com">
<div id="doc3" class="yui-t2">

	<div id="hd">
        <h1>Yahoo! UI Library</h1>
        <h3>YAHOO Global&nbsp; <span class="subtitle">2.2.2</span></h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_yahoo.html">yahoo</a>
                
                 &gt; YAHOO.js (source view) 
            </p>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">

                    <div id="srcout">
<div class="highlight" ><pre><span class="c">/**</span>
<span class="c"> * The YAHOO object is the single global object used by YUI Library.  It</span>
<span class="c"> * contains utility function for setting up namespaces, inheritance, and</span>
<span class="c"> * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces</span>
<span class="c"> * created automatically for and used by the library.</span>
<span class="c"> * @module yahoo</span>
<span class="c"> * @title  YAHOO Global</span>
<span class="c"> */</span>

<span class="c">/**</span>
<span class="c"> * YAHOO_config is not included part of the library.  Instead it is an object</span>
<span class="c"> * that can be defined by the implementer immediately before including the</span>
<span class="c"> * YUI library.  The properties included in this object will be used to</span>
<span class="c"> * configure global properties needed as soon as the library begins to load.</span>
<span class="c"> * @class YAHOO_config</span>
<span class="c"> * @static</span>
<span class="c"> */</span>

<span class="c">/**</span>
<span class="c"> * A reference to a function that will be executed every time a YAHOO module</span>
<span class="c"> * is loaded.  As parameter, this function will receive the version</span>
<span class="c"> * information for the module. See &lt;a href=&quot;YAHOO.env.html#getVersion&quot;&gt;</span>
<span class="c"> * YAHOO.env.getVersion&lt;/a&gt; for the description of the version data structure.</span>
<span class="c"> * @property listener</span>
<span class="c"> * @static</span>
<span class="c"> */</span>
<span class="k">if</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">YAHOO</span> <span class="o">==</span> <span class="s2">&quot;undefined&quot;</span><span class="o">)</span> <span class="o">{</span>
    <span class="c">/**</span>
<span class="c">     * The YAHOO global namespace object.  If YAHOO is already defined, the</span>
<span class="c">     * existing YAHOO object will not be overwritten so that defined</span>
<span class="c">     * namespaces are preserved.</span>
<span class="c">     * @class YAHOO</span>
<span class="c">     * @static</span>
<span class="c">     */</span>
    <span class="k">var</span> <span class="nx">YAHOO</span> <span class="o">=</span> <span class="o">{};</span>
<span class="o">}</span>

<span class="c">/**</span>
<span class="c"> * Returns the namespace specified and creates it if it doesn&#39;t exist</span>
<span class="c"> * &lt;pre&gt;</span>
<span class="c"> * YAHOO.namespace(&quot;property.package&quot;);</span>
<span class="c"> * YAHOO.namespace(&quot;YAHOO.property.package&quot;);</span>
<span class="c"> * &lt;/pre&gt;</span>
<span class="c"> * Either of the above would create YAHOO.property, then</span>
<span class="c"> * YAHOO.property.package</span>
<span class="c"> *</span>
<span class="c"> * Be careful when naming packages. Reserved words may work in some browsers</span>
<span class="c"> * and not others. For instance, the following will fail in Safari:</span>
<span class="c"> * &lt;pre&gt;</span>
<span class="c"> * YAHOO.namespace(&quot;really.long.nested.namespace&quot;);</span>
<span class="c"> * &lt;/pre&gt;</span>
<span class="c"> * This fails because &quot;long&quot; is a future reserved word in ECMAScript</span>
<span class="c"> *</span>
<span class="c"> * @method namespace</span>
<span class="c"> * @static</span>
<span class="c"> * @param  {String*} arguments 1-n namespaces to create </span>
<span class="c"> * @return {Object}  A reference to the last namespace object created</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">namespace</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">a</span><span class="o">=</span><span class="nx">arguments</span><span class="o">,</span> <span class="nx">o</span><span class="o">=</span><span class="kc">null</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">d</span><span class="o">;</span>
    <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">a</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">d</span><span class="o">=</span><span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">split</span><span class="o">(</span><span class="s2">&quot;.&quot;</span><span class="o">);</span>
        <span class="nx">o</span><span class="o">=</span><span class="nx">YAHOO</span><span class="o">;</span>

        <span class="c">// YAHOO is implied, so it is ignored if it is included</span>
<span class="c"></span>        <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=(</span><span class="nx">d</span><span class="o">[</span><span class="m">0</span><span class="o">]</span> <span class="o">==</span> <span class="s2">&quot;YAHOO&quot;</span><span class="o">)</span> <span class="o">?</span> <span class="m">1</span> <span class="o">:</span> <span class="m">0</span><span class="o">;</span> <span class="nx">j</span><span class="o">&lt;</span><span class="nx">d</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">o</span><span class="o">[</span><span class="nx">d</span><span class="o">[</span><span class="nx">j</span><span class="o">]]=</span><span class="nx">o</span><span class="o">[</span><span class="nx">d</span><span class="o">[</span><span class="nx">j</span><span class="o">]]</span> <span class="o">||</span> <span class="o">{};</span>
            <span class="nx">o</span><span class="o">=</span><span class="nx">o</span><span class="o">[</span><span class="nx">d</span><span class="o">[</span><span class="nx">j</span><span class="o">]];</span>
        <span class="o">}</span>
    <span class="o">}</span>

    <span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Uses YAHOO.widget.Logger to output a log message, if the widget is</span>
<span class="c"> * available.</span>
<span class="c"> *</span>
<span class="c"> * @method log</span>
<span class="c"> * @static</span>
<span class="c"> * @param  {String}  msg  The message to log.</span>
<span class="c"> * @param  {String}  cat  The log category for the message.  Default</span>
<span class="c"> *                        categories are &quot;info&quot;, &quot;warn&quot;, &quot;error&quot;, time&quot;.</span>
<span class="c"> *                        Custom categories can be used as well. (opt)</span>
<span class="c"> * @param  {String}  src  The source of the the message (opt)</span>
<span class="c"> * @return {Boolean}      True if the log operation was successful.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">msg</span><span class="o">,</span> <span class="nx">cat</span><span class="o">,</span> <span class="nx">src</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">l</span><span class="o">=</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">widget</span><span class="o">.</span><span class="nx">Logger</span><span class="o">;</span>
    <span class="k">if</span><span class="o">(</span><span class="nx">l</span> <span class="o">&amp;&amp;</span> <span class="nx">l</span><span class="o">.</span><span class="nx">log</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">l</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="nx">msg</span><span class="o">,</span> <span class="nx">cat</span><span class="o">,</span> <span class="nx">src</span><span class="o">);</span>
    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
        <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>


<span class="c">/**</span>
<span class="c"> * Initializes the global by creating the default namespaces and applying</span>
<span class="c"> * any new configuration information that is detected.</span>
<span class="c"> * @method init</span>
<span class="c"> * @static</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">init</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
    <span class="k">this</span><span class="o">.</span><span class="nx">namespace</span><span class="o">(</span><span class="s2">&quot;util&quot;</span><span class="o">,</span> <span class="s2">&quot;widget&quot;</span><span class="o">,</span> <span class="s2">&quot;example&quot;</span><span class="o">);</span>
    <span class="k">if</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">YAHOO_config</span> <span class="o">!=</span> <span class="s2">&quot;undefined&quot;</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">var</span> <span class="nx">l</span><span class="o">=</span><span class="nx">YAHOO_config</span><span class="o">.</span><span class="nx">listener</span><span class="o">,</span><span class="nx">ls</span><span class="o">=</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">listeners</span><span class="o">,</span><span class="nx">unique</span><span class="o">=</span><span class="kc">true</span><span class="o">,</span><span class="nx">i</span><span class="o">;</span>
        <span class="k">if</span> <span class="o">(</span><span class="nx">l</span><span class="o">)</span> <span class="o">{</span>
            <span class="c">// if YAHOO is loaded multiple times we need to check to see if</span>
<span class="c"></span>            <span class="c">// this is a new config object.  If it is, add the new component</span>
<span class="c"></span>            <span class="c">// load listener to the stack</span>
<span class="c"></span>            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">ls</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="k">if</span> <span class="o">(</span><span class="nx">ls</span><span class="o">[</span><span class="nx">i</span><span class="o">]==</span><span class="nx">l</span><span class="o">)</span> <span class="o">{</span>
                    <span class="nx">unique</span><span class="o">=</span><span class="kc">false</span><span class="o">;</span>
                    <span class="k">break</span><span class="o">;</span>
                <span class="o">}</span>
            <span class="o">}</span>
            <span class="k">if</span> <span class="o">(</span><span class="nx">unique</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">ls</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">l</span><span class="o">);</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Registers a module with the YAHOO object</span>
<span class="c"> * @method register</span>
<span class="c"> * @static</span>
<span class="c"> * @param {String}   name    the name of the module (event, slider, etc)</span>
<span class="c"> * @param {Function} mainClass a reference to class in the module.  This</span>
<span class="c"> *                             class will be tagged with the version info</span>
<span class="c"> *                             so that it will be possible to identify the</span>
<span class="c"> *                             version that is in use when multiple versions</span>
<span class="c"> *                             have loaded</span>
<span class="c"> * @param {Object}   data      metadata object for the module.  Currently it</span>
<span class="c"> *                             is expected to contain a &quot;version&quot; property</span>
<span class="c"> *                             and a &quot;build&quot; property at minimum.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">register</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">name</span><span class="o">,</span> <span class="nx">mainClass</span><span class="o">,</span> <span class="nx">data</span><span class="o">)</span> <span class="o">{</span>
    <span class="k">var</span> <span class="nx">mods</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">modules</span><span class="o">;</span>
    <span class="k">if</span> <span class="o">(!</span><span class="nx">mods</span><span class="o">[</span><span class="nx">name</span><span class="o">])</span> <span class="o">{</span>
        <span class="nx">mods</span><span class="o">[</span><span class="nx">name</span><span class="o">]</span> <span class="o">=</span> <span class="o">{</span> <span class="nx">versions</span><span class="o">:[],</span> <span class="nx">builds</span><span class="o">:[]</span> <span class="o">};</span>
    <span class="o">}</span>
    <span class="k">var</span> <span class="nx">m</span><span class="o">=</span><span class="nx">mods</span><span class="o">[</span><span class="nx">name</span><span class="o">],</span><span class="nx">v</span><span class="o">=</span><span class="nx">data</span><span class="o">.</span><span class="nx">version</span><span class="o">,</span><span class="nx">b</span><span class="o">=</span><span class="nx">data</span><span class="o">.</span><span class="nx">build</span><span class="o">,</span><span class="nx">ls</span><span class="o">=</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">listeners</span><span class="o">;</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span><span class="o">;</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">version</span> <span class="o">=</span> <span class="nx">v</span><span class="o">;</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">build</span> <span class="o">=</span> <span class="nx">b</span><span class="o">;</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">versions</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">v</span><span class="o">);</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">builds</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">b</span><span class="o">);</span>
    <span class="nx">m</span><span class="o">.</span><span class="nx">mainClass</span> <span class="o">=</span> <span class="nx">mainClass</span><span class="o">;</span>
    <span class="c">// fire the module load listeners</span>
<span class="c"></span>    <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">i</span><span class="o">&lt;</span><span class="nx">ls</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">ls</span><span class="o">[</span><span class="nx">i</span><span class="o">](</span><span class="nx">m</span><span class="o">);</span>
    <span class="o">}</span>
    <span class="c">// label the main class</span>
<span class="c"></span>    <span class="k">if</span> <span class="o">(</span><span class="nx">mainClass</span><span class="o">)</span> <span class="o">{</span>
        <span class="nx">mainClass</span><span class="o">.</span><span class="nx">VERSION</span> <span class="o">=</span> <span class="nx">v</span><span class="o">;</span>
        <span class="nx">mainClass</span><span class="o">.</span><span class="nx">BUILD</span> <span class="o">=</span> <span class="nx">b</span><span class="o">;</span>
    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
        <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;mainClass is undefined for module &quot;</span> <span class="o">+</span> <span class="nx">name</span><span class="o">,</span> <span class="s2">&quot;warn&quot;</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * YAHOO.env is used to keep track of what is known about the YUI library and</span>
<span class="c"> * the browsing environment</span>
<span class="c"> * @class YAHOO.env</span>
<span class="c"> * @type Object</span>
<span class="c"> * @static</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span> <span class="o">||</span> <span class="o">{</span>
    <span class="c">/**</span>
<span class="c">     * Keeps the version info for all YUI modules that have reported themselves</span>
<span class="c">     * @property modules</span>
<span class="c">     * @type Object[]</span>
<span class="c">     */</span>
    <span class="nx">modules</span><span class="o">:</span> <span class="o">[],</span>
    
    <span class="c">/**</span>
<span class="c">     * List of functions that should be executed every time a YUI module</span>
<span class="c">     * reports itself.</span>
<span class="c">     * @property listeners</span>
<span class="c">     * @type Function[]</span>
<span class="c">     */</span>
    <span class="nx">listeners</span><span class="o">:</span> <span class="o">[],</span>
    
    <span class="c">/**</span>
<span class="c">     * Returns the version data for the specified module:</span>
<span class="c">     *      &lt;dl&gt;</span>
<span class="c">     *      &lt;dt&gt;name:&lt;/dt&gt;      &lt;dd&gt;The name of the module&lt;/dd&gt;</span>
<span class="c">     *      &lt;dt&gt;version:&lt;/dt&gt;   &lt;dd&gt;The version in use&lt;/dd&gt;</span>
<span class="c">     *      &lt;dt&gt;build:&lt;/dt&gt;     &lt;dd&gt;The build number in use&lt;/dd&gt;</span>
<span class="c">     *      &lt;dt&gt;versions:&lt;/dt&gt;  &lt;dd&gt;All versions that were registered&lt;/dd&gt;</span>
<span class="c">     *      &lt;dt&gt;builds:&lt;/dt&gt;    &lt;dd&gt;All builds that were registered.&lt;/dd&gt;</span>
<span class="c">     *      &lt;dt&gt;mainClass:&lt;/dt&gt; &lt;dd&gt;An object that was was stamped with the</span>
<span class="c">     *                 current version and build. If </span>
<span class="c">     *                 mainClass.VERSION != version or mainClass.BUILD != build,</span>
<span class="c">     *                 multiple versions of pieces of the library have been</span>
<span class="c">     *                 loaded, potentially causing issues.&lt;/dd&gt;</span>
<span class="c">     *       &lt;/dl&gt;</span>
<span class="c">     *</span>
<span class="c">     * @method getVersion</span>
<span class="c">     * @static</span>
<span class="c">     * @param {String}  name the name of the module (event, slider, etc)</span>
<span class="c">     * @return {Object} The version info</span>
<span class="c">     */</span>
    <span class="nx">getVersion</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">name</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">env</span><span class="o">.</span><span class="nx">modules</span><span class="o">[</span><span class="nx">name</span><span class="o">]</span> <span class="o">||</span> <span class="kc">null</span><span class="o">;</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="c">/**</span>
<span class="c"> * Provides the language utilites and extensions used by the library</span>
<span class="c"> * @class YAHOO.lang</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span> <span class="o">=</span> <span class="o">{</span>
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is an array</span>
<span class="c">     * @method isArray</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isArray</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span> <span class="c">// frames lose type, so test constructor string</span>
<span class="c"></span>        <span class="k">if</span> <span class="o">(</span><span class="nx">obj</span> <span class="o">&amp;&amp;</span> <span class="nx">obj</span><span class="o">.</span><span class="nx">constructor</span> <span class="o">&amp;&amp;</span> 
                   <span class="nx">obj</span><span class="o">.</span><span class="nx">constructor</span><span class="o">.</span><span class="nx">toString</span><span class="o">().</span><span class="nx">indexOf</span><span class="o">(</span><span class="s1">&#39;Array&#39;</span><span class="o">)</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isObject</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="nx">obj</span><span class="o">.</span><span class="nx">constructor</span> <span class="o">==</span> <span class="nb">Array</span><span class="o">;</span>
        <span class="o">}</span>
    <span class="o">},</span>

    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a boolean</span>
<span class="c">     * @method isBoolean</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isBoolean</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;boolean&#39;</span><span class="o">;</span>
    <span class="o">},</span>
    
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a function</span>
<span class="c">     * @method isFunction</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isFunction</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;function&#39;</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is null</span>
<span class="c">     * @method isNull</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isNull</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">obj</span> <span class="o">===</span> <span class="kc">null</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a legal number</span>
<span class="c">     * @method isNumber</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isNumber</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;number&#39;</span> <span class="o">&amp;&amp;</span> <span class="nb">isFinite</span><span class="o">(</span><span class="nx">obj</span><span class="o">);</span>
    <span class="o">},</span>
      
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is of type object</span>
<span class="c">     * or function</span>
<span class="c">     * @method isObject</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>  
    <span class="nx">isObject</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="nx">obj</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;object&#39;</span> <span class="o">||</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isFunction</span><span class="o">(</span><span class="nx">obj</span><span class="o">));</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is a string</span>
<span class="c">     * @method isString</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isString</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;string&#39;</span><span class="o">;</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the provided object is undefined</span>
<span class="c">     * @method isUndefined</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">isUndefined</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">return</span> <span class="k">typeof</span> <span class="nx">obj</span> <span class="o">==</span> <span class="s1">&#39;undefined&#39;</span><span class="o">;</span>
    <span class="o">},</span>
    
    <span class="c">/**</span>
<span class="c">     * Determines whether or not the property was added</span>
<span class="c">     * to the object instance.  Returns false if the property is not present</span>
<span class="c">     * in the object, or was inherited from the prototype.</span>
<span class="c">     * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.</span>
<span class="c">     * There is a discrepancy between YAHOO.lang.hasOwnProperty and</span>
<span class="c">     * Object.prototype.hasOwnProperty when the property is a primitive added to</span>
<span class="c">     * both the instance AND prototype with the same value:</span>
<span class="c">     * &lt;pre&gt;</span>
<span class="c">     * var A = function() {};</span>
<span class="c">     * A.prototype.foo = &#39;foo&#39;;</span>
<span class="c">     * var a = new A();</span>
<span class="c">     * a.foo = &#39;foo&#39;;</span>
<span class="c">     * alert(a.hasOwnProperty(&#39;foo&#39;)); // true</span>
<span class="c">     * alert(YAHOO.lang.hasOwnProperty(a, &#39;foo&#39;)); // false when using fallback</span>
<span class="c">     * &lt;/pre&gt;</span>
<span class="c">     * @method hasOwnProperty</span>
<span class="c">     * @param {any} obj The object being testing</span>
<span class="c">     * @return Boolean</span>
<span class="c">     */</span>
    <span class="nx">hasOwnProperty</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">obj</span><span class="o">,</span> <span class="nx">prop</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(</span><span class="nb">Object</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">return</span> <span class="nx">obj</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">prop</span><span class="o">);</span>
        <span class="o">}</span>
        
        <span class="k">return</span> <span class="o">!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isUndefined</span><span class="o">(</span><span class="nx">obj</span><span class="o">[</span><span class="nx">prop</span><span class="o">])</span> <span class="o">&amp;&amp;</span> 
                <span class="nx">obj</span><span class="o">.</span><span class="nx">constructor</span><span class="o">.</span><span class="nx">prototype</span><span class="o">[</span><span class="nx">prop</span><span class="o">]</span> <span class="o">!==</span> <span class="nx">obj</span><span class="o">[</span><span class="nx">prop</span><span class="o">];</span>
    <span class="o">},</span>
        
    <span class="c">/**</span>
<span class="c">     * Utility to set up the prototype, constructor and superclass properties to</span>
<span class="c">     * support an inheritance strategy that can chain constructors and methods.</span>
<span class="c">     *</span>
<span class="c">     * @method extend</span>
<span class="c">     * @static</span>
<span class="c">     * @param {Function} subc   the object to modify</span>
<span class="c">     * @param {Function} superc the object to inherit</span>
<span class="c">     * @param {Object} overrides  additional properties/methods to add to the</span>
<span class="c">     *                              subclass prototype.  These will override the</span>
<span class="c">     *                              matching items obtained from the superclass </span>
<span class="c">     *                              if present.</span>
<span class="c">     */</span>
    <span class="nx">extend</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">subc</span><span class="o">,</span> <span class="nx">superc</span><span class="o">,</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(!</span><span class="nx">superc</span><span class="o">||!</span><span class="nx">subc</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="o">(</span><span class="s2">&quot;YAHOO.lang.extend failed, please check that &quot;</span> <span class="o">+</span>
                            <span class="s2">&quot;all dependencies are included.&quot;</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">var</span> <span class="nx">F</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{};</span>
        <span class="nx">F</span><span class="o">.</span><span class="nx">prototype</span><span class="o">=</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">;</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">=</span><span class="k">new</span> <span class="nx">F</span><span class="o">();</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span><span class="o">=</span><span class="nx">subc</span><span class="o">;</span>
        <span class="nx">subc</span><span class="o">.</span><span class="nx">superclass</span><span class="o">=</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">;</span>
        <span class="k">if</span> <span class="o">(</span><span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span> <span class="o">==</span> <span class="nb">Object</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span><span class="o">)</span> <span class="o">{</span>
            <span class="nx">superc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">constructor</span><span class="o">=</span><span class="nx">superc</span><span class="o">;</span>
        <span class="o">}</span>
    
        <span class="k">if</span> <span class="o">(</span><span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">overrides</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">subc</span><span class="o">.</span><span class="nx">prototype</span><span class="o">[</span><span class="nx">i</span><span class="o">]=</span><span class="nx">overrides</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">},</span>
    
    <span class="c">/**</span>
<span class="c">     * Applies all prototype properties in the supplier to the receiver if the</span>
<span class="c">     * receiver does not have these properties yet.  Optionally, one or more</span>
<span class="c">     * methods/properties can be specified (as additional parameters).  This</span>
<span class="c">     * option will overwrite the property if receiver has it already.</span>
<span class="c">     *</span>
<span class="c">     * @method augment</span>
<span class="c">     * @static</span>
<span class="c">     * @param {Function} r  the object to receive the augmentation</span>
<span class="c">     * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c">     * @param {String*}  arguments zero or more properties methods to augment the</span>
<span class="c">     *                             receiver with.  If none specified, everything</span>
<span class="c">     *                             in the supplier will be used unless it would</span>
<span class="c">     *                             overwrite an existing property in the receiver</span>
<span class="c">     */</span>
    <span class="nx">augment</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
        <span class="k">if</span> <span class="o">(!</span><span class="nx">s</span><span class="o">||!</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
            <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="o">(</span><span class="s2">&quot;YAHOO.lang.augment failed, please check that &quot;</span> <span class="o">+</span>
                            <span class="s2">&quot;all dependencies are included.&quot;</span><span class="o">);</span>
        <span class="o">}</span>
        <span class="k">var</span> <span class="nx">rp</span><span class="o">=</span><span class="nx">r</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span> <span class="nx">sp</span><span class="o">=</span><span class="nx">s</span><span class="o">.</span><span class="nx">prototype</span><span class="o">,</span> <span class="nx">a</span><span class="o">=</span><span class="nx">arguments</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">p</span><span class="o">;</span>
        <span class="k">if</span> <span class="o">(</span><span class="nx">a</span><span class="o">[</span><span class="m">2</span><span class="o">])</span> <span class="o">{</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span><span class="o">=</span><span class="m">2</span><span class="o">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="nx">a</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
                <span class="nx">rp</span><span class="o">[</span><span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">]]</span> <span class="o">=</span> <span class="nx">sp</span><span class="o">[</span><span class="nx">a</span><span class="o">[</span><span class="nx">i</span><span class="o">]];</span>
            <span class="o">}</span>
        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
            <span class="k">for</span> <span class="o">(</span><span class="nx">p</span> <span class="k">in</span> <span class="nx">sp</span><span class="o">)</span> <span class="o">{</span> 
                <span class="k">if</span> <span class="o">(!</span><span class="nx">rp</span><span class="o">[</span><span class="nx">p</span><span class="o">])</span> <span class="o">{</span>
                    <span class="nx">rp</span><span class="o">[</span><span class="nx">p</span><span class="o">]</span> <span class="o">=</span> <span class="nx">sp</span><span class="o">[</span><span class="nx">p</span><span class="o">];</span>
                <span class="o">}</span>
            <span class="o">}</span>
        <span class="o">}</span>
    <span class="o">}</span>
<span class="o">};</span>

<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">init</span><span class="o">();</span>

<span class="c">/*</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html&quot;&gt;YAHOO.lang&lt;/a&gt;</span>
<span class="c"> * @class YAHOO.util.Lang</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Lang</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">;</span>

<span class="c">/**</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html#augment&quot;&gt;YAHOO.lang.augment&lt;/a&gt;</span>
<span class="c"> * @for YAHOO</span>
<span class="c"> * @method augment</span>
<span class="c"> * @static</span>
<span class="c"> * @param {Function} r  the object to receive the augmentation</span>
<span class="c"> * @param {Function} s  the object that supplies the properties to augment</span>
<span class="c"> * @param {String*}  arguments zero or more properties methods to augment the</span>
<span class="c"> *                             receiver with.  If none specified, everything</span>
<span class="c"> *                             in the supplier will be used unless it would</span>
<span class="c"> *                             overwrite an existing property in the receiver</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">augment</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">augment</span><span class="o">;</span>
       
<span class="c">/**</span>
<span class="c"> * An alias for &lt;a href=&quot;YAHOO.lang.html#extend&quot;&gt;YAHOO.lang.extend&lt;/a&gt;</span>
<span class="c"> * @method extend</span>
<span class="c"> * @static</span>
<span class="c"> * @param {Function} subc   the object to modify</span>
<span class="c"> * @param {Function} superc the object to inherit</span>
<span class="c"> * @param {Object} overrides  additional properties/methods to add to the</span>
<span class="c"> *                              subclass prototype.  These will override the</span>
<span class="c"> *                              matching items obtained from the superclass </span>
<span class="c"> *                              if present.</span>
<span class="c"> */</span>
<span class="nx">YAHOO</span><span class="o">.</span><span class="nx">extend</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">extend</span><span class="o">;</span>
</pre></div>
                    </div>
			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_button.html">button</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class=""><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_datasource.html">datasource</a></li>

                                <li class=""><a href="module_datatable.html">datatable</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_element.html">element</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_history.html">history</a></li>

                                <li class=""><a href="module_logger.html">logger</a></li>

                                <li class=""><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class="selected"><a href="module_yahoo.html">yahoo</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.html">YAHOO</a></li>
                                <li class=""><a href="YAHOO.env.html">YAHOO.env</a></li>
                                <li class=""><a href="YAHOO.lang.html">YAHOO.lang</a></li>
                                <li class=""><a href="YAHOO_config.html">YAHOO_config</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class="selected"><a href="YAHOO.js.html">YAHOO.js</a></li>
                        </ul>
                    </div>





            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
